import { loginByTestAPI } from "@/api/profile";

export default {
  namespaced: true,
  state: {
    profile: null,
  },
  getters: {},
  mutations: {
    saveProfile(state, payload) {
      state.profile = payload;
    },
  },
  actions: {
    async loginByTest({ commit }) {
      const { result } = await loginByTestAPI("13512312312");

      commit("saveProfile", result);

      uni.showToast({
        title: "登录成功",
        icon: "success",
      });

      setTimeout(() => {
        uni.navigateBack();
      }, 1500);
    },
  },
};
